﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WaterCtrlReservatedCode.aspx.cs" Inherits="WeChat.UserInfo.WaterCtrlReservatedCode" %>

<!DOCTYPE html>


<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>水控预约记录查询</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <script src="../bootstrap-3.3.5-dist/js/jquery-1.11.3.min.js" type="text/javascript"></script>
    <link href="../bootstrap-3.3.5-dist/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
    <link href="../layui/css/layui.css" rel="stylesheet" />
    <script src="../bootstrap-3.3.5-dist/js/bootstrap.min.js" type="text/javascript"></script>
</head>
<body>
    <form id="form1" runat="server">
     
<div id="panel1" runat="server" class="panel panel-default">
   <div class="panel-heading">
      <h3 class="panel-title text-center">我的预约记录</h3>
   </div>
   
   <div class="panel-body">
   <div class="form-group">
   <div class="col-xs-2"></div>
        <div  class="btn-group col-xs-2">
           <button type="button" style="width:auto; color:#fff; background-color:#427DBF;border: 1px solid #427DBF" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
              选择查询时间 <span class="caret"></span>
           </button>
              <ul class="dropdown-menu" role="menu" style="text-align:center">
              <li><a id="A1" href="#" runat="server" onserverclick="days">今日预约记录</a></li>
              <li><a id="A2" href="#" runat="server" onserverclick="days">7天内预约记录</a></li>
              <li><a id="A3" href="#" runat="server" onserverclick="days">30天内预约记录</a></li>
              <li><a id="A4" href="#" runat="server" onserverclick="days">一年内预约记录</a></li>
           </ul>
        </div>
        <div class="col-xs-4"></div>
	<a href='../index.html'  style="width:auto;  position: absolute;  left:75%; top:59px; align-content:center; color:#fff; background-color:#427DBF;border: 1px solid #427DBF;" class="btn btn-default dropdown-toggle" 
        <%--data-toggle="dropdown"--%> <%--onclick='javascript :history.back(-1);'--%>>返回首页</a>

   </div>
  </div>
   <div style="color:#337AB7">
    <table id="tb1" runat="server" style="width:100%" visible="false">
        <tr>
                     
          <%--  <td style="width:60%"><asp:Label ID="dateslive" runat="server"></asp:Label></td>
            <td><span>消费总额:</span></td>
            <td><asp:Label ID="costs" runat="server" ForeColor="Red"></asp:Label></td>--%>
            <%--<td style="color:Black">元</td>--%>
        </tr>
    </table>
   </div>
     <asp:Repeater id="cdcatalog" runat="server">
        <HeaderTemplate>
        <table class="table table-striped">
        <caption></caption>
        <tr>
        <th >预约时间</th>
        <th >预约位置</th>
        <th>预约码</th>
        <th>预约状态</th>
        <th>操作</th>
        </tr>
        </HeaderTemplate>

        <ItemTemplate>
        <tr>
        <td ><%# Eval("stime")%></br><%# Eval("etime")%></td>
        <td><%# Eval("wz")%></td>
        <td><%# Eval("code")%></td>
        <td><%# Eval("state")%></td>
        <td class="cancel" wz="<%# Eval("wz")%>" etime="<%# Eval("etime")%>" data ="<%# Eval("code")%>">            
           <button type="button" class="layui-btn layui-btn-primary layui-btn-xs" style="background-color: #427DBF; color: white;">取消预约</button>
        </td>
        </tr>
        </ItemTemplate>

        <FooterTemplate>
        </table>
        </FooterTemplate>
     </asp:Repeater>
</div>
<div id="panel2" runat="server" style="text-align:center; color:#337AB7; padding-top:50px" visible="false">您还未绑定账号，无法查看信息哦~</div>

</form>

    <script src="../layui/layui.js"></script>
    <script type="text/javascript">
        var rfkh ="<%=rfkh%>";
        $(".cancel").click(function () {

            var etime = $(this).attr("etime");
            if (new Date(etime) < new Date()) {
                alert("此条预约已不可取消！"); return false;
            }
            var code = $(this).attr("data");
            var wz = $(this).attr("wz");
            $.ajax({
                type: "POST",
                url: "../WaterReserveHandler.ashx",
                data: { code: code, etime: etime, wz: wz, rfkh: rfkh, funcName: "cancel" },
                success: function (data) {
                    if (data == "10000") {
                        alert("取消成功！");
                    } else if (data == "10005") {
                        alert("取消失败！");
                    } else if (data == "10006") {
                        alert("已到预约时间不可取消！");
                    }
                    window.location.reload();
                },
                Error: function (errMsg) {

                }
            });
        });


    </script>
</body>
</html>
